<?php
class DisplayLimitPanel extends PageElement
{
	protected $limit = 10;
	protected $start = 0;
	
	public function setLimit($limit)
	{
//		echo ("SetLimit ".$limit."<br>\n");
		$this->limit = $limit;
	}
	
	public function setStart($start)
	{
//		echo ("SetStart ".$start."<br>\n");
		$this->start = $start;
	}
	
	public function getHTML()
	{
		$html = "<div class=\"".$this->name."Div\"><p>\n";
		
		$start = new Hidden();
		$start->setName($this->name."Start");
		$start->setValue($this->start); 
		$html .= $start->getHTML();
		
		$html .= "Show first ";
		
		$ddl = new DropDownList();
		$ddl->setName($this->name.'Number');
		$ddl->addOption(new DropDownListOption('10','10'));
		$ddl->addOption(new DropDownListOption('20','20'));
		$ddl->addOption(new DropDownListOption('50','50'));
		$ddl->addOption(new DropDownListOption('100','100'));
		
//		echo("setSelectedValue - ".$this->limit."<br>\n");
		$ddl->setSelectedValue($this->limit);
		$ddl->setOnChange("OnChange".$this->name."();");
		
		$html .= $ddl->getHTML();
		$html .= " results per page, start at ".$this->start."&nbsp;&nbsp;";

		$back = new Span();
		$back->setName($this->name."Back");
		$back->setCSSClass($this->name."Button");
		$back->setOnMouseOver("OnMouseOver".$this->name."Back();");
		$back->setOnMouseOut("OnMouseOut".$this->name."Back();");
		$back->setOnClick("OnClick".$this->name."Back();");
		$back->setText("Back");
		$html .= $back->getHTML();
		
		$forward = new Span();
		$forward->setName($this->name."Forward");
		$forward->setCSSClass($this->name."Button");
		$forward->setOnMouseOver("OnMouseOver".$this->name."Forward();");
		$forward->setOnMouseOut("OnMouseOut".$this->name."Forward();");
		$forward->setOnClick("OnClick".$this->name."Forward();");
		$forward->setText("Forward");
		$html .= $forward->getHTML();
		
		
		$html .= "\n";
		
		$html .= "</p></div>\n";
		
		return $html;	
	}
	
}